FrameMetricsAggregator

This class can be used to record and return data about per-frame durations. It returns those results in an array per metric type, with the results indicating how many samples were recorded for each duration value. The details of the durations data are described in getMetrics.

For more information on the various metrics tracked, see the documentation for the FrameMetrics API added in API 24 as well as the GPU Profiling guide.

Constructors

Link copied to clipboard
constructor()
Constructs a FrameMetricsAggregator object that will track TOTAL_DURATION metrics.
constructor(metricTypeFlags: Int)
Constructs a FrameMetricsAggregator object that will track the metrics specified bty metricTypeFlags, which is a value derived by OR'ing together metrics constants such as TOTAL_DURATION to specify all metrics that should be tracked.

Types

Link copied to clipboard

Properties

Link copied to clipboard
A flag indicating that the metrics should track the animation duration.
Link copied to clipboard
The index in the metrics array where the data for ANIMATION_DURATION is stored.
Link copied to clipboard
A flag indicating that the metrics should track the command duration.
Link copied to clipboard
The index in the metrics array where the data for SYNC_DURATION is stored.
Link copied to clipboard
val DELAY_DURATION: Int = 128
A flag indicating that the metrics should track the delay duration.
Link copied to clipboard
val DELAY_INDEX: Int = 7
The index in the metrics array where the data for DELAY_DURATION is stored.
Link copied to clipboard
A flag indicating that the metrics should track the draw duration.
Link copied to clipboard
val DRAW_INDEX: Int = 3
The index in the metrics array where the data for DRAW_DURATION is stored.
Link copied to clipboard
val EVERY_DURATION: Int = 511
A flag indicating that the metrics should track all durations.
Link copied to clipboard
A flag indicating that the metrics should track the input duration.
Link copied to clipboard
val INPUT_INDEX: Int = 1
The index in the metrics array where the data for INPUT_DURATION is stored.
Link copied to clipboard
A flag indicating that the metrics should track the layout duration.
Link copied to clipboard
The index in the metrics array where the data for LAYOUT_MEASURE_DURATION is stored.
Link copied to clipboard
val SWAP_DURATION: Int = 64
A flag indicating that the metrics should track the swap duration.
Link copied to clipboard
val SWAP_INDEX: Int = 6
The index in the metrics array where the data for COMMAND_DURATION is stored.
Link copied to clipboard
val SYNC_DURATION: Int = 16
A flag indicating that the metrics should track the sync duration.
Link copied to clipboard
val SYNC_INDEX: Int = 4
The index in the metrics array where the data for SYNC_DURATION is stored.
Link copied to clipboard
A flag indicating that the metrics should track the total duration.
Link copied to clipboard
val TOTAL_INDEX: Int = 0
The index in the metrics array where the data for TOTAL_DURATION is stored.

Functions

Link copied to clipboard
open fun add(@NonNull activity: @NonNull Activity)
Starts recording frame metrics for the given activity.
Link copied to clipboard
open fun getMetrics(): @Nullable Array<SparseIntArray>
Returns the currently-collected metrics in an array of SparseIntArray objects.
Link copied to clipboard
open fun remove(@NonNull activity: @NonNull Activity): @Nullable Array<SparseIntArray>
Stops recording metrics for activity and returns the collected metrics so far.
Link copied to clipboard
open fun reset(): @Nullable Array<SparseIntArray>
Resets the metrics data and returns the currently-collected metrics.
Link copied to clipboard
open fun stop(): @Nullable Array<SparseIntArray>
Stops recording metrics for all Activities currently being tracked.